package com.iyue;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 
 * 
 * @author 孙晓晔
 * @version $Id: AppContext.java,v 1.3 2010/11/25 14:14:39 fresh Exp $
 */
public class AppContext {
	private static AppContext instance;

	private volatile AbstractApplicationContext appContext;

	public synchronized static AppContext getInstance() {
		if (instance == null) {
			instance = new AppContext();
		}

		return instance;
	}

	private AppContext() {
		List<String> list = new ArrayList<String>();
		list.add("/cfg/cache.xml");
		list.add("/cfg/sso.xml");
		list.add("/cfg/config.xml");
		list.add("/cfg/test.xml");
		list.add("/cfg/service/spring_service.xml");
		list.add("/cfg/spring/Spring_dbconfig.xml");
		
		String ss[] = list.toArray(new String[] {});

		this.appContext = new ClassPathXmlApplicationContext(ss);
	}

	public AbstractApplicationContext getAppContext() {
		return appContext;
	}
}
